package com.neusoft.control;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.neusoft.bean.AdminInfoBean;
import com.neusoft.bean.AdminInfoBeanQuery;
import com.neusoft.myutils.MyUtil;
import com.neusoft.service.AdminInfoService;


@WebServlet("/DeleteAdminServlet")
public class DeleteAdminServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		AdminInfoBeanQuery adminBQ = MyUtil.convertRequestParameters2Bean(request, AdminInfoBeanQuery.class);
		int deleteNum = MyUtil.getInstance(AdminInfoService.class).deleteAdminInfo(adminBQ);
		if (deleteNum>0) {
			request.getSession().setAttribute("deleteNum", deleteNum);
			List<AdminInfoBean> adminlst = MyUtil.getInstance(AdminInfoService.class).getAllAdminInfo();
			request.getSession().setAttribute("adminlst", adminlst);
			response.sendRedirect("deleteAdmin/deleteAdmin.jsp");
		}
	}

}
